package com.usian.controller;


import com.usian.feign.SSOServiceFeign;
import com.usian.pojo.TbUser;
import com.usian.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/frontend/sso")
public class SSOController {
    @Autowired
    private SSOServiceFeign ssoServiceFeign;

    @RequestMapping("checkUserInfo/{checkValue}/{checkFlag}")
    public Result checkUserInfo(@PathVariable String checkValue,@PathVariable Integer checkFlag){

        boolean c = ssoServiceFeign.checkUserInfo(checkValue, checkFlag);
        if (c){
            return Result.ok(c);
        }
        return Result.error("校验失败");
    }

    @RequestMapping("/userRegister")
    public Result userRegister(TbUser user){
        Integer userRegister = ssoServiceFeign.userRegister(user);
        if (userRegister==1){
            return Result.ok();
        }
        return  Result.error("注册失败");
    }

}